package dao.factory;

import dao.AdminDao;
import dao.CategoriesDao;
import dao.FoodsDao;
import dao.MerchantDao;
import dao.impl.AdminDaoImpl;
import dao.impl.CategoriesDaoImpl;
import dao.impl.FoodsDaoImpl;
import dao.impl.MerchantDaoImpl;

//所有dao的工厂方法在这里
public class DaoFactory {
	
	private static AdminDao adminDao;
	
	private static MerchantDao merchantDao;
	
	private static CategoriesDao categoriesDao;
	
	private static FoodsDao foodsDao;
	
	public static AdminDao getAdminDaoInstance(){
		if (adminDao==null) {
			adminDao = new AdminDaoImpl();
		}
		return adminDao;
	}
	
	public static MerchantDao getMerchantDaoInstance(){
		if (merchantDao==null) {
			merchantDao = new MerchantDaoImpl();
		}
		return merchantDao;
	}
	public static CategoriesDao getCategoriesDaoInstance(){
		if (categoriesDao==null) {
			categoriesDao = new CategoriesDaoImpl();
		}
		return categoriesDao;
	}

	public static FoodsDao getFoodsDaoInstance(){
		if (foodsDao==null) {
			foodsDao = new FoodsDaoImpl();
		}
		return foodsDao;
	}


}
